<template>
	<view class="container">
		<view class="detail">
			{{content}}
		</view>
	</view>
</template>
<script>
	export default {
		data() {
			return {
				id: '',
				content: ''
			}
		},
		methods: {
			async mark_as_read() {
				let res = await this.$fetch(this.$api.mark_as_read, {
					id: this.id
				}, 'POST')
				if (res.code) return uni.showToast({
					title: res.msg,
					icon: 'none'
				})
			},
			async get_push_message_records_details() {
				let res = await this.$fetch(this.$api.get_push_message_records_details, {
					id: this.id
				}, 'POST')
				if (res.code) return uni.showToast({
					title: res.msg,
					icon: 'none'
				})
				uni.setNavigationBarTitle({
					title: res.data.title
				});
				this.content = res.data.content
				if (res.data.status == 0) {
					this.mark_as_read()
				}
			}
		},
		onLoad(option) {
			this.id = option.id
			this.get_push_message_records_details()
		},
		onShareAppMessage() {
			if (uni.getStorageSync('userType') == 1) {
				return {
					title: "足不出户，免费招工",
					desc: "线上招募零工，工价透明，免费使用",
					path: `/pages/start-n/start-n`,
					imageUrl: 'https://images.linglinggong.net/static/employer-share.jpg',
					success: res => {}
				}
			} else {
				return {
					title: "在家找日结兼职，工种齐全",
					desc: "免费使用，提前在家找日结兼职",
					path: `/pages/start-n/start-n`,
					imageUrl: 'https://images.linglinggong.net/static/employee-share.jpg',
					success: res => {}
				}
			}
		},
	}
</script>
<style lang="less" scoped>
	.container {
		.detail {
			width: 690rpx;
			margin: 20rpx auto;
			border-radius: 16rpx;
			box-sizing: border-box;
			padding: 28rpx;
			background-color: #FFFFFF;
			color: #515151;
		}
	}
</style>